import 'package:built_collection/built_collection.dart';
import 'package:dartz/dartz.dart';
import 'package:equatable/equatable.dart';
import 'package:website.core/core/domain/entities/app_store/app_store_purchased_item.dart';
import 'package:website.core/core/domain/entities/google_play/google_play_purchased_item.dart';
import 'package:website.core/core/domain/entities/web/web_purchased_item.dart';
import 'package:website.core/core/domain/entities/web/web_purchased_subscription.dart';
import 'package:website.core/core/domain/errors/failures.dart';

part 'failures/order_placing_failures.dart';

part 'failures/purchased_item_getting_failures.dart';

part 'failures/web_purchased_subscription_auto_renewal_enablement_failures.dart';

part 'failures/web_purchased_subscription_cancellation_failures.dart';

part 'results/order_placing_result.dart';

part 'results/purchased_item_getting_result.dart';

abstract class PurchasedItemRepository {
  Future<Either<OrderPlacingFailure, OrderPlacingResult>> placeOrder({
    required String purchaseItemSku,
    required String returnUrl,
  });

  Future<Either<PurchasedItemGettingFailure, PurchasedItemGettingResult>> getPurchasedItems();

  Future<Either<WebPurchasedSubscriptionCancellationFailure, WebPurchasedSubscription>>
      cancelWebPurchasedSubscription({
    required String originalTransactionId,
  });

  Future<Either<WebPurchasedSubscriptionAutoRenewalEnablementFailure, WebPurchasedSubscription>>
      enableWebPurchasedSubscriptionAutoRenewal({
    required String originalTransactionId,
  });
}
